<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>城市空气质量 - 城市列表</title>
    <style>
        .city-container { display: flex; flex-wrap: wrap; gap: 20px; padding: 20px; }
        .city-card { width: 300px; border: 1px solid #eee; border-radius: 8px; overflow: hidden; }
        .city-card img { width: 100%; height: 180px; object-fit: cover; }
        .city-info { padding: 15px; }
        .aqi { display: inline-block; padding: 3px 8px; border-radius: 4px; color: white; }
        .good { background: #4CAF50; } /* 优 */
        .moderate { background: #FFC107; } /* 良 */
    </style>
</head>
<body>
    <!-- 导航栏（按指导书要求） -->
    <nav>
        <a href="../index.html">首页</a>
        <a href="cities.html">城市列表</a>
        <a href="chart.html">数据可视化</a>
        <a href="login.html" id="userLink">登录</a>
    </nav>

    <h2 style="text-align:center;">热门城市空气质量</h2>
    <div class="city-container">
        <!-- 城市卡片（静态内容展示） -->
        <div class="city-card">
            <img src="../images/beijing.jpg" alt="北京">
            <div class="city-info">
                <h3>北京</h3>
                <p>AQI：<span class="aqi good">65</span>（良）</p>
                <p>主要污染物：PM2.5</p>
                <p>健康建议：适宜户外活动</p>
            </div>
        </div>

        <div class="city-card">
            <img src="../images/shanghai.jpg" alt="上海">
            <div class="city-info">
                <h3>上海</h3>
                <p>AQI：<span class="aqi good">52</span>（良）</p>
                <p>主要污染物：臭氧</p>
                <p>健康建议：敏感人群减少长时间户外</p>
            </div>
        </div>

        <div class="city-card">
            <img src="../images/guangzhou.jpg" alt="广州">
            <div class="city-info">
                <h3>广州</h3>
                <p>AQI：<span class="aqi moderate">98</span>（良）</p>
                <p>主要污染物：PM10</p>
                <p>健康建议：正常活动，注意防护</p>
            </div>
        </div>
    </div>

    <script>
        // 显示当前登录用户
        const currentUser = JSON.parse(localStorage.getItem('currentUser'));
        if (currentUser) {
            document.getElementById('userLink').textContent = `欢迎 ${currentUser.username}`;
        }
    </script>
</body>
</html>